package model

import business.Attackable
import business.Blockable
import business.Destoryable
import business.Sufferable
import org.itheima.kotlin.game.core.Painter

/**
 * 大本营里面的鹰
 *
 * 阻碍运动的能力
 * 接受攻击的能力
 * 销毁的能力
 *
 * */
class Eagle(override val x: Int, override val y: Int) :IView ,Blockable,Sufferable,Destoryable{
    override val width: Int=GameConfig.BLOCK_WIDTH
    override val height: Int=GameConfig.BLOCK_WIDTH

    override var pool: Int=1

    override fun draw() {
        Painter.drawImage("img/eagle.gif",x,y)
    }

    override fun notifySuffer(attack: Attackable): ArrayList<IView> {
        pool-=attack.power
        return arrayListOf<IView>(Blast(x,y))
    }

    override fun isDestory(): Boolean {
        return pool<=0
    }
}